﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ExtAspNet;
namespace HealthSystem.ReportPage
{
    public partial class ReportIndex : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                districtsearch.OnClientTriggerClick = Window1.GetSaveStateReference(districtid.ClientID, districtsearch.ClientID)
                      + Window1.GetShowReference("~/ChooseDistrict.aspx","选择区域");
                if (Request["reportid"] != null)
                {
                    year.DataSource = ReportCofig.GetReportYear();
                    year.DataTextField = "YearName";
                    year.DataValueField = "YearCode";
                    year.DataBind();
                }
                if (CustomerProfile.RoleId == 1003 || CustomerProfile.RoleId == 1012)
                {
                    districtid.Text = CustomerProfile.AdminUser.DistrictCode;
                    districtsearch.Text = CustomerProfile.AdminUser.hW_District.Name;
                    districtsearch.Readonly = true;
                }
            }
        }
        protected void countbt_Click(object sender, EventArgs e)
        {
            if (Request["reportid"] != null)
            {
                string sdistrict = districtid.Text;
                if (string.IsNullOrEmpty(sdistrict))
                {
                    if (CustomerProfile.RoleId == 1002||CustomerProfile.RoleId==1003)
                    {
                        sdistrict = CustomerProfile.DistrictId;
                    }
                }
                //PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                string ctype = counttype.SelectedValue;
                string url = "report1.aspx?reportid=" + Request["reportid"].ToString() + "&tjnd=" + year.SelectedValue + "&schooltype=" + schooltype.SelectedValue + "&schoolcntype=" + schooltype.SelectedText + "&districtid=" + sdistrict + "&ctype=" + ctype;
                PageContext.RegisterStartupScript(Window2.GetShowReference(url, "报表"));
                //Response.Redirect(url);
            }
        }
    }
}